// pages/people/people.js
var app = getApp()
Page({
  data: {
    userInfo: {},
    
    originWeight: '0KG',
    nowWeight: '0KG',
    titleWeight: '0KG',

    userListInfo: [{
      url: '../information/information',
      icon: '../../images/people_infor.png',
      text: '个人资料',
      next: '../../images/next.png'
    }]
  },


  onShow: function () {
    if (app.globalData.userInfo) {
      this.setData({
        userInfo: app.globalData.userInfo,
        hasUserInfo: true
      })
    }
    this.showReportValues()
  },


  showReportValues () {
    let nowWeight = 0
    let weightLog = wx.getStorageSync('weight_log')
    if (weightLog && weightLog.length) nowWeight = weightLog[weightLog.length - 1].value

    let healthy_report_source = wx.getStorageSync('healthy_report_source')
      this.setData({
        originWeight: app.globalData.userObject.beginWeight + 'KG',
        nowWeight: nowWeight + 'KG',
        titleWeight: app.globalData.userObject.targetWeight+'KG',
      })
  },




  //事件处理函数
  bindViewTap: function () {
    wx.navigateTo({
      url: 'information/information'
    })
  },
})